package com.effective;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class User implements Cloneable{
	private Date date;
	
	public User(Date date) {
		super();
		this.date = date;
	}
	
	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	@Override
	public String toString() {
		return "User [date=" + date + "]";
	}
	
	@Override
	protected User clone() throws CloneNotSupportedException {
		User u = (User) super.clone();
		u.date = (Date) date.clone();
		return u;
	}

	public static void main(String[] args) throws CloneNotSupportedException {
		User us = new User(new Date());

		User clone = us;
		System.out.println(us.date);
		System.out.println(clone.date);
		List<Object> s = new ArrayList<>();
		s.add("s");
		s.add("2");
		System.out.println(s);
	}
}
